<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>proCONTROLL : : ControllIO</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body> 
<div id="page"> 
  <div id="describtion"> 
    <div id="libname"><img src="images/procontroll.gif" width="259" height="40"></div> 
    <div id="indexlink"><a href="index.htm"><img src="images/index.gif"></a></div> 
  </div> 
  <div id="point"> 
    <div id="pointname"> name </div> 
    <div id="pointcontent"><div id="membertitle"> ControllIO </div></div> 
  </div> 
  <div id="point"> 
    <div id="pointname"><a href="#" id="exampleButton" onClick="handleExample()">openExample</a></div> 
    <div id="pointcontent"><div id="example"><pre>import processing.opengl.*;

import procontroll.*;
import net.java.games.input.*;

ControllIO controllIO;
ControllDevice joypad;
ControllStick stick1;
ControllStick stick2;

float transX;
float transY;

void setup(){
  size(600,600,OPENGL);

  transX = width/2;
  transY = height/2;

  controllIO = ControllIO.getInstance(this);

  joypad = controllIO.getDevice("Logitech RumblePad 2 USB");
  joypad.plug(this, "handleButton1Press", ControllIO.ON_PRESS, 1);
  joypad.plug(this, "handleButton1Release", ControllIO.ON_RELEASE, 1);
  joypad.plug(this, "handleMovement", ControllIO.WHILE_PRESS, 0);

  stick1 = joypad.getStick(0);
  stick1.setMultiplier(PI);

  stick2 = joypad.getStick(1);
  stick2.setTolerance(0.06f);
  stick2.setMultiplier(0.05f);
}

void handleButton1Press(){
  fill(255,0,0);
  joypad.rumble(1);
}

void handleButton1Release(){
  fill(255);
}

void handleMovement(final float i_x,final float i_y){
  transX += i_x;
  transY += i_y;
}

void draw(){
  background(0);
  lights();
  translate(transX,transY,0);
  rotateX(stick2.getTotalY());
  rotateY(stick2.getTotalX());
  box(200);
}
</pre></div></div> 
  </div> 
  <div id="point"> 
    <div id="pointname"> description </div> 
    <div id="pointcontent"><p>
 ControllIO is the base class for using controllers in Processing.
 It provides methods to retrieve information about the connected 
 devices and to get the input data from them.<br>
 To get a ControllIO object you to use the getInstance() Method. As
 a startup you should use the printDevices() to see if all Controllers
 are connected and correctly found.
 </p>
 <p>
 To react on button events you can plug methods, that are called when
 a button is pressed, released or while a button is pressed.</div> 
  </div> 
  <div id="point"> 
    <div id="pointname"> constructors </div> 
    <div id="pointcontent"> 
      <pre>none available
</pre> 
    </div> 
  </div> 
     
<div id="point"> 
  <div id="pointname"> methods </div> 
  <div id="members"> 
<div id="membername"><a href="controllio_method_getdevice.htm">getDevice ( )</a></div> 
<div id="memberdesc">Use this method to get a device.</div> 
 
<div id="membername"><a href="controllio_method_getinstance.htm">getInstance ( )</a></div> 
<div id="memberdesc">Use this method to get a ControllIO instance.</div> 
 
<div id="membername"><a href="controllio_method_getnumberofdevices.htm">getNumberOfDevices ( )</a></div> 
<div id="memberdesc">Returns the number of available Devices</div> 
 
<div id="membername"><a href="controllio_method_plug.htm">plug ( )</a></div> 
<div id="memberdesc">Plugs a method to handle button events.</div> 
 
<div id="membername"><a href="controllio_method_printdevices.htm">printDevices ( )</a></div> 
<div id="memberdesc">Lists the available Devices in the console window.</div> 
</div> 
</div> 

  <div id="point"> 
    <div id="pointname"> usage </div> 
    <div id="pointcontent">application</div> 
  </div> 
  <div id="point"> 
    <div id="pointname"> related </div> 
    <div id="pointcontent"><A href="controlldevice_class_controlldevice.htm">ControllDevice</A><BR>
</div> 
  </div> 
</div> 
</body>
<script language="JavaScript" src="script.js" type="text/javascript"></script>
</html>
